package io.datajek.springbasics.movierecommendersystem.lesson11;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
//@Qualifier("CBF")
//@Primary
public class ContentBasedFilter implements Filter {
    private Logger logger =
            LoggerFactory.getLogger(this.getClass());
    public ContentBasedFilter(){
    super();
    logger.info("In ContentBasedFilter constructor method");
}

@PostConstruct
private void postConstruct(){
//将电影加载到缓存中
logger.info("In ContentBasedFilter postConstruct method");
    }
    @PreDestroy
    private void preDestroy() {
        //从缓存中清除电影
        logger.info("In ContentBasedFilter preDestroy method");
    }
    public String[] getRecommendations(String movie){

        //实现基于内容过滤器逻辑

        //返回电影推荐
        return new String[] {"Happy Feet", "Ice Age", "Shark Tale"};
    }
}
